import 'package:url_launcher/url_launcher.dart';

import 'toast_util.dart';

/// <summary>
/// todo: 操作URL
/// author：zwb
/// dateTime：2021/9/2 15:10
/// filePath：lib/utils/open_util.dart
/// desc:
/// <summary>
///
class OpenUrl {
  /// 打开app
  static schemesLaunch(String schemes) async {
    if (!await canLaunch(schemes)) return toast("请检查是否安装相关程序");
    await launch(schemes);
  }

  static tel(String schemes) async => schemesLaunch("tel:"+schemes);

  static sms(schemes) async => schemesLaunch("sms:"+schemes);

  static createEmail (schemes) async => schemesLaunch("mailto:"+schemes);

  static url (schemes) async => schemesLaunch(schemes);
}
